<script setup>
import { MYURL } from '@/utils/express/express.js'
import { userStore } from "@/stores/user.js"
// import { computed, ref } from 'vue'
import Vrouter from "@/router"
const router = Vrouter
const changeFriend = userStore() 
const query = router.currentRoute.value.query.up
</script>
<template>
    <div class="back-ground"></div>
    <div class="main" v-show="changeFriend.TwoStartList.length != 0">
        <div class="nav_title" @click="router.replace(`${changeFriend.IsMyself ? 'user_star' : `personal_star?up=${query}`}`)">
            <div class="left">
                <p>收藏</p>
                <p>{{ changeFriend.StartList.length }}</p>
            </div>
            <div class="right">
                <p>查看更多</p>
                <img src="@/assets/img/getback.png">
            </div>
        </div>
        <div class="video_put">
            <div v-for="video in changeFriend.TwoStartList" :key="video.id"
                @click="router.push(`videodetail?id=${video.id}`)" class="video_img">
                <img :src="MYURL + '/public/videoimages/' + video.image">
                <div style="padding: 10px;">
                    <p class="video_title">{{ video.title }}</p>
                </div>
            </div>
        </div>
    </div>

    <div class="main" v-show="changeFriend.TwoGoodList.length != 0">
        <div class="nav_title" @click="router.replace(`${changeFriend.IsMyself ? 'user_good' : `personal_good?up=${query}`}`)">
            <div class="left">
                <p>点赞</p>
                <p>{{ changeFriend.GoodList.length }}</p>
            </div>
            <div class="right">
                <p>查看更多</p>
                <img src="@/assets/img/getback.png">
            </div>
        </div>
        <div class="video_put">
            <div v-for="video in changeFriend.TwoGoodList" @click="router.push(`videodetail?id=${video.id}`)"
                :key="video.id" class="video_img">
                <img :src="MYURL + '/public/videoimages/' + video.image">
                <div style="padding: 10px;">
                    <p class="video_title">{{ video.title }}</p>
                </div>
            </div>
        </div>
    </div>

    <div class="main" v-show="changeFriend.TwoVideoList.length != 0">
        <div class="nav_title" @click="router.replace(`${changeFriend.IsMyself ? 'user_add' : `personal_add?up=${query}`}`)">
            <div class="left">
                <p>视频</p>
                <p>{{ changeFriend.VideoList.length }}</p>
            </div>
            <div class="right">
                <p>查看更多</p>
                <img src="@/assets/img/getback.png">
            </div>
        </div>
        <div class="video_put">
            <div v-for="video in changeFriend.TwoVideoList" @click="router.push(`videodetail?id=${video.id}`)"
                :key="video.id" class="video_img">
                <img :src="MYURL + '/public/videoimages/' + video.image">
                <div style="padding: 10px;">
                    <p class="video_title">{{ video.title }}</p>
                </div>
            </div>
        </div>
    </div>
</template>
<style lang="less" scoped>
.back-ground {
    position: fixed;
    top: 0;
    left: 0;
    background-color: #f2f3f5;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.main {
    padding: 0 10px;
    margin-top: 20px;
}

.nav_title {
    display: flex;

    div {
        display: flex;
        align-items: center;

        img {
            transform: rotate(180deg);
            width: 8px;
            opacity: .5;
        }
    }

    .right {
        gap: 8px;
        font-size: 13px;
        color: #95999f;
        margin-left: auto;
    }

    .left {
        gap: 8px;
        font-size: 13px;

        :last-child {
            color: #95999f;
            font-size: 13px;
        }
    }
}

.video_put {
    margin: 10px 0;
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
}

.video_img {
    width: 45vw;
    margin-top: 5px;
    background-color: white;
    border-radius: 5px;

    img {
        border-radius: 5px 5px 0 0;
        width: 100%;
        height: 25vw;
        object-fit: contain;
        background-color: black;
    }

    p {
        font-size: 13px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2; // 控制多行的行数
        -webkit-box-orient: vertical;
    }
}
</style>